<% /* $Id: users.jsp 82 2010-10-20 08:32:13Z altdotua@gmail.com $ */ %>

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@include file="../header.jsp"%>	

<%
	
%>

<h2 align="center">Contest Users</h2>

<table border="1" align="center">
	<tr>
		<th>СUserID</th>
		<th>СUserName</th>
		<th>СRole</th>
		<th>UserID</th>
		<th>UserName</th>
		<th>Role</th>
		<th>Active</th>
		<th colspan="2">Actions</th>
	</tr>
	
<%
	List<ContestUserEntry> entries2 = ContestUsersModel.getContestUserEntries(contest.getId().toString());
	for (ContestUserEntry entry: entries2)
	{
%>
	<tr>
		<td><%= entry.getId()  %></td>
		<td><%= entry.getName()  %></td>
		<td><%= entry.getRole()  %></td>
		<td><a href="<%= Linker.link("contests/admin/user.jsp?contest_id=" + contest.getId() + "&user_id=" + entry.getUserId()) %>">Edit</a></td>
		<td><a href="<%= Linker.link("contestusers?action=delete&id=" + entry.getId()) %>">Delete</a></td>
	</tr>
<%
	}
%>
	
</table>




<h2>Add contest user</h2>

<form action="<%= Linker.link("contestusers") %>" method="post">
	<input type="hidden" name="action" value="edit">
	<input type="hidden" name="id" value="">
	<p>Contest
		<select name="contestId">
			<option value="<%= contest.getId() %>" selected="selected" : "" %><%= contest %> 
		</select>
	</p>  
	<p>User
		<select name="userId">
<%
	List<UserEntry> users = UsersModel.getAllEntries();
	for (UserEntry user2 : users)
	{
%>
			<option value="<%= user2.getId() %>"><%= user2 %> 
<%
 	}
%>
		</select>
	</p>
	<p>Role
		<select name="role">
			<option value="user">user</option>
			<option value="judge">judge</option>
			<option value="admin">admin</option>
			<option value="board">board</option>
		</select>
	</p>
	<p><input type="checkbox" name="active" checked="checked">Active?</p>
	<p><input type="submit" value="Submit"></p>
</form>


<%@include file="../footer.jsp"%>
